<template>
  <div class="app-page-box">
    <div class="app-page">
      <div class="query-top">
        <a-button class="add" @click="onAdd">
          <img src="/@/assets/images/authorization.png" alt="" style="width: 28rem; height: 26rem; margin-right: 19rem" />
          新增授权</a-button
        >
        <a-form layout="inline" :model="queryForm" class="query-form">
          <a-form-item label="" name="bussNo">
            <a-input v-model:value="queryForm.bussNo" placeholder="请输入申请号" style="width: 200rem" />
          </a-form-item>
          <a-form-item label="" name="name">
            <a-input v-model:value="queryForm.name" placeholder="请输入授权人姓名" style="width: 200rem" />
          </a-form-item>
          <a-form-item label="" name="certNo">
            <a-input v-model:value="queryForm.certNo" placeholder="请输入证件号" style="width: 200rem" />
          </a-form-item>
          <a-form-item label="" name="submitUserName">
            <a-input v-model:value="queryForm.submitUserName" placeholder="请输入提交人名称" style="width: 200rem" />
          </a-form-item>
          <a-form-item label="授权角色" name="roleType">
            <a-select placeholder="请选择" v-model:value="queryForm.roleType" style="width: 200rem">
              <a-select-option v-for="item in roleType" :key="item.optionCode" :value="item.optionCode">{{ item.optionName }}</a-select-option>
            </a-select>
          </a-form-item>
          <a-form-item label="签约状态" name="flowStatus">
            <a-select placeholder="请选择审核结果" v-model:value="queryForm.flowStatus" style="width: 200rem">
              <a-select-option v-for="item in flowStatus" :key="item.optionCode" :value="item.optionCode">{{ item.optionName }}</a-select-option>
            </a-select>
          </a-form-item>
          <a-form-item label="征信结果" name="ruleResult">
            <a-select placeholder="选择审核状态" v-model:value="queryForm.ruleResult" style="width: 200rem">
              <a-select-option v-for="item in ruleResult" :key="item.optionCode" :value="item.optionCode">{{ item.optionName }}</a-select-option>
            </a-select>
          </a-form-item>
          <a-form-item label="征信结果" name="imageStatus">
            <a-select placeholder="选择审核状态" v-model:value="queryForm.imageStatus" style="width: 200rem">
              <a-select-option value="1">成功</a-select-option>
              <a-select-option value="0">失败</a-select-option>
            </a-select>
          </a-form-item>
          <a-form-item>
            <a-button type="primary" class="submit" @click="onSubmit" size="small"> 查询 </a-button>
            <a-button> 重置 </a-button>
          </a-form-item>
        </a-form>
      </div>
      <a-table :loading="spinning" :pagination="false" :dataSource="dataSource" :columns="columns" :scroll="{ x: 2000, }">
        <template #certType="{ record }">
          <span>{{ getCertType(record.certType) }}</span>
        </template>
        <template #roleType="{ record }">
          <span>{{ getRoleType(record.roleType) }}</span>
        </template>
        <template #queryReason="{ record }">
          <span>{{ getQueryReason(record.queryReason) }}</span>
        </template>
        <template #flowStatus="{ record }">
          <a-tag :color="record.flowStatus == 2?'green':record.flowStatus==0?'orange':record.flowStatus==1?'blue':'red'">{{ getFlowStatus(record.flowStatus) }}</a-tag>
        </template>
        <template #ruleResult="{ record }">
          <span>{{ getRuleResult(record.ruleResult) }}</span>
        </template>
        <template #startDate="{ record }">
          <span>{{ record.startDate }}至{{ record.endDate }}</span>
        </template>
        <template #backImageStatus="{ record }">
          <a-tag :color="record.backImageStatus == 1 && record.frontImageStatus == 1 ? 'green' : 'red'">{{
            record.backImageStatus == 1 && record.frontImageStatus == 1 ? '识别成功' : '识别失败'
          }}</a-tag>
        </template>
        <template #certBegin="{ record }">
          <span>{{ record.certBegin }}至{{ record.certEnd }}</span>
        </template>
        <template #operate="{ record }">
          <div>
            <span class="operate-btn" v-if="record.flowStatus == 0" @click="signStart(record.id)">签约</span>
            <span class="operate-btn" v-if="record.flowStatus == 0">修改</span>
            <span class="operate-btn" v-if="record.flowStatus == 0" @click="onDel(record.id)">删除</span>
            <span class="operate-btn" v-if="record.flowStatus == 1 || record.flowStatus == 2" @click="onSignQry(record.id)">状态</span>
            <span class="operate-btn" v-if="record.flowStatus == 1" @click="onPreviewAuthReport(record.bussNO)">预览征信</span>
            <span class="operate-btn" v-if="record.flowStatus == 1" @click="onSignRush(record.id)">催签</span>
            <span class="operate-btn" v-if="record.flowStatus == 1" @click="onSignQryUrl(record.id)">链接</span>
            <span class="operate-btn" v-if="record.flowStatus == 1" @click="onSignRevoke(record.id)">撒销</span>

            <a-dropdown>
              <span class="operate-btn" @click.prevent>
                更多
                <DownOutlined />
              </span>
              <template #overlay>
                <a-menu>
                  <a-menu-item>
                    <span>查看身份证</span>
                  </a-menu-item>
                  <a-menu-item v-if="record.backImageStatus != 1 || record.frontImageStatus != 1">
                    <span>重传身份证</span>
                  </a-menu-item>
                  <a-menu-divider />
                  <a-menu-item>
                    <span @click="onPreviewDownAuth('V', 'ZX', record)">预览人行征信查询授权书</span>
                  </a-menu-item>
                  <a-menu-item>
                    <span @click="onPreviewDownAuth('D', 'ZX', record)">下载人行征信查询授权书</span>
                  </a-menu-item>
                  <a-menu-divider />
                  <a-menu-item>
                    <span @click="onPreviewDownAuth('V', 'BH', record)">预览百行征信查询授权书</span>
                  </a-menu-item>
                  <a-menu-item>
                    <span @click="onPreviewDownAuth('D', 'BH', record)">下载百行征信查询授权书</span>
                  </a-menu-item>
                  <a-menu-divider />
                  <a-menu-item>
                    <span @click="onPreviewDownAuth('V', 'TD', record)">预览朴道教据查询授权书</span>
                  </a-menu-item>
                  <a-menu-item>
                    <span @click="onPreviewDownAuth('D', 'TD', record)">下载朴道教据查询授权书</span>
                  </a-menu-item>
                  <a-menu-divider />
                  <a-menu-item>
                    <span @click="onPreviewDownAuth('V', 'SQ', record)">预览农机租赁业务申请书</span>
                  </a-menu-item>
                  <a-menu-item>
                    <span @click="onPreviewDownAuth('D', 'SQ', record)">下载农机租赁业务申请书</span>
                  </a-menu-item>
                </a-menu>
              </template>
            </a-dropdown>
          </div>
        </template>
      </a-table>

      <a-pagination class="pager" :total="50" show-size-changer show-quick-jumper />
      <Create ref="createRef" :certType="certType" :roleType="roleType" :queryReason="queryReason" />
    </div>
  </div>
</template>

<script setup>
  import { ref } from 'vue';
  import { zxJobApi } from '/@/api/system/zxJob';
  import clipboard3 from 'vue-clipboard3';
  import { message, Modal } from 'ant-design-vue';
  import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
  import { createVNode } from 'vue';
  import Create from './components/create.vue';
  const { toClipboard } = clipboard3();
  const queryForm = ref({
    bussNo: '',
    name: '',
    certNo: null,
    submitUserName: null,
    roleType: null,
    flowStatus: '',
    ruleResult: '',
    imageStatus: '',
  });
  const createRef = ref(null);
  const spinning = ref(false);
  const dataSource = ref( [{
                "id": "3df7a7fe4e634923a812d110c3e2f85d",
                "version": 0,
                "status": "1",
                "creator": "000180",
                "createTime": "2025-03-05 22:01:01",
                "editor": "000180",
                "editTime": "2025-03-05 22:01:01",
                "remark": "",
                "bussNo": "NJZL-ZX-202503-0002",
                "name": "按时的",
                "certType": "ID_CARD",
                "certNo": "230121199303202218",
                "roleType": "1",
                "mobile": "13144221234",
                "startDate": null,
                "endDate": null,
                "term": null,
                "relationId": null,
                "isOverdue": "0",
                "queryReason": "1",
                "useCache": null,
                "useCacheDays": null,
                "ruleResult": "1",
                "ruleDesc": null,
                "submitUser": "000180",
                "submitDeptid": "运营科技部",
                "submitTime": null,
                "remark1": "",
                "remark2": "",
                "remark3": "",
                "submitUserName": "孙志阳",
                "frontImageUrl": "192.168.51.19:8081/6,58373fc72926",
                "backImageUrl": "192.168.51.19:8083/4,58384e6024d0",
                "frontOcrId": null,
                "backOcrId": null,
                "frontImageStatus": "0",
                "backImageStatus": "0",
                "noBussDesc": null,
                "sponsorId": null,
                "sponsorDeptid": null,
                "certBegin": null,
                "certEnd": null,
                "certIsLong": "N",
                "homeAddress": null,
                "homeAddressCode": null,
                "homeAddressValue": null,
                "nation": null,
                "signOrg": null,
                "currentPage": null,
                "numPerPage": null,
                "flowId": null,
                "flowStatus": "0",
                "flowSignTime": null,
                "imageStatus": null,
                "ruleRemark": null,
                "edealStartTime": null,
                "edealEndTime": null,
                "submitStartTime": null,
                "submitEndTime": null,
                "departs": null,
                "sponsorName": null,
                "sponsorDeptName": null,
                "queryType": null,
                "dealerIds": null,
                "dealerUsers": null
            },
            {
                "id": "19a69f41a86245488589ae480ef914bf",
                "version": 0,
                "status": "1",
                "creator": "000180",
                "createTime": "2025-03-04 23:18:43",
                "editor": "000180",
                "editTime": "2025-03-04 23:18:43",
                "remark": "123",
                "bussNo": "NJZL-ZX-202503-0001",
                "name": "按时的",
                "certType": "ID_CARD",
                "certNo": "230121199408212228",
                "roleType": "1",
                "mobile": "13144221111",
                "startDate": null,
                "endDate": null,
                "term": null,
                "relationId": null,
                "isOverdue": "0",
                "queryReason": "1",
                "useCache": null,
                "useCacheDays": null,
                "ruleResult": "1",
                "ruleDesc": null,
                "submitUser": "000180",
                "submitDeptid": "运营科技部",
                "submitTime": null,
                "remark1": "",
                "remark2": "",
                "remark3": "",
                "submitUserName": "孙志阳",
                "frontImageUrl": "192.168.51.19:8083/1,58187ff44ad9",
                "backImageUrl": "192.168.51.19:8083/1,5819450941cc",
                "frontOcrId": null,
                "backOcrId": null,
                "frontImageStatus": "0",
                "backImageStatus": "0",
                "noBussDesc": null,
                "sponsorId": null,
                "sponsorDeptid": null,
                "certBegin": null,
                "certEnd": null,
                "certIsLong": "N",
                "homeAddress": null,
                "homeAddressCode": null,
                "homeAddressValue": null,
                "nation": null,
                "signOrg": null,
                "currentPage": null,
                "numPerPage": null,
                "flowId": null,
                "flowStatus": "0",
                "flowSignTime": null,
                "imageStatus": null,
                "ruleRemark": null,
                "edealStartTime": null,
                "edealEndTime": null,
                "submitStartTime": null,
                "submitEndTime": null,
                "departs": null,
                "sponsorName": null,
                "sponsorDeptName": null,
                "queryType": null,
                "dealerIds": null,
                "dealerUsers": null
            },
            {
                "id": "1d44271b9917466e86bd8806256c4000",
                "version": 0,
                "status": "1",
                "creator": "000143",
                "createTime": "2024-12-22 20:54:40",
                "editor": "A00143",
                "editTime": "2025-01-21 09:09:05",
                "remark": "1备注备注备注备注1",
                "bussNo": "NJZL-ZX-202412-0001",
                "name": "公维鑫",
                "certType": "ID_CARD",
                "certNo": "231024199411111115",
                "roleType": "1",
                "mobile": "18145100270",
                "startDate": "2025-01-08",
                "endDate": "2025-02-07",
                "term": 30,
                "relationId": "5ad297d731f74225a660f01ddb83c0e9",
                "isOverdue": "1",
                "queryReason": "1",
                "useCache": null,
                "useCacheDays": null,
                "ruleResult": "4",
                "ruleDesc": null,
                "submitUser": "000143",
                "submitDeptid": "运营科技部",
                "submitTime": "2025-01-08 14:25:29",
                "remark1": "",
                "remark2": "20250108;",
                "remark3": "",
                "submitUserName": "刁维立",
                "frontImageUrl": "192.168.51.19:8083/2,5543391502bc",
                "backImageUrl": "192.168.51.19:8083/5,55e0450d8ee8",
                "frontOcrId": null,
                "backOcrId": null,
                "frontImageStatus": "1",
                "backImageStatus": "1",
                "noBussDesc": null,
                "sponsorId": null,
                "sponsorDeptid": null,
                "certBegin": "2012-10-01",
                "certEnd": "2032-10-01",
                "certIsLong": "N",
                "homeAddress": null,
                "homeAddressCode": null,
                "homeAddressValue": null,
                "nation": "汉",
                "signOrg": null,
                "currentPage": null,
                "numPerPage": null,
                "flowId": "a02f76095639474c8d3c57b9154c3aa1",
                "flowStatus": "2",
                "flowSignTime": "2025-01-08 14:27:35",
                "imageStatus": null,
                "ruleRemark": null,
                "edealStartTime": null,
                "edealEndTime": null,
                "submitStartTime": null,
                "submitEndTime": null,
                "departs": null,
                "sponsorName": null,
                "sponsorDeptName": null,
                "queryType": null,
                "dealerIds": null,
                "dealerUsers": null
            },
            {
                "id": "1d44271b9917466e86bd8806256c4d17",
                "version": 0,
                "status": "1",
                "creator": "000143",
                "createTime": "2024-12-22 20:54:40",
                "editor": "A00143",
                "editTime": "2025-01-09 08:32:22",
                "remark": "1备注备注备注备注1",
                "bussNo": "NJZL-ZX-202411-0013",
                "name": "刁维立",
                "certType": "ID_CARD",
                "certNo": "230227198605170812",
                "roleType": "2",
                "mobile": "18145100270",
                "startDate": "2025-01-08",
                "endDate": "2025-02-07",
                "term": 30,
                "relationId": "5ad297d731f74225a660f01ddb83c0e9",
                "isOverdue": "1",
                "queryReason": "1",
                "useCache": null,
                "useCacheDays": null,
                "ruleResult": "4",
                "ruleDesc": null,
                "submitUser": "000143",
                "submitDeptid": "运营科技部",
                "submitTime": "2025-01-08 14:25:29",
                "remark1": "",
                "remark2": "20250108;",
                "remark3": "",
                "submitUserName": "刁维立",
                "frontImageUrl": "192.168.51.19:8083/2,5543391502bc",
                "backImageUrl": "192.168.51.19:8083/5,55e0450d8ee8",
                "frontOcrId": null,
                "backOcrId": null,
                "frontImageStatus": "1",
                "backImageStatus": "1",
                "noBussDesc": null,
                "sponsorId": null,
                "sponsorDeptid": null,
                "certBegin": "2012-10-01",
                "certEnd": "2032-10-01",
                "certIsLong": "N",
                "homeAddress": null,
                "homeAddressCode": null,
                "homeAddressValue": null,
                "nation": "汉",
                "signOrg": null,
                "currentPage": null,
                "numPerPage": null,
                "flowId": "a02f76095639474c8d3c57b9154c3aa2",
                "flowStatus": "2",
                "flowSignTime": "2025-01-08 14:27:35",
                "imageStatus": null,
                "ruleRemark": null,
                "edealStartTime": null,
                "edealEndTime": null,
                "submitStartTime": null,
                "submitEndTime": null,
                "departs": null,
                "sponsorName": null,
                "sponsorDeptName": null,
                "queryType": null,
                "dealerIds": null,
                "dealerUsers": null
            },
            {
                "id": "1d44271b9917466e86bd8806256c4d16",
                "version": 0,
                "status": "1",
                "creator": "000143",
                "createTime": "2024-12-16 11:14:15",
                "editor": "A00143",
                "editTime": "2025-01-09 08:32:22",
                "remark": "1备注备注备注备注1",
                "bussNo": "NJZL-ZX-202411-0012",
                "name": "刁维立",
                "certType": "ID_CARD",
                "certNo": "230227198605170812",
                "roleType": "1",
                "mobile": "18145100270",
                "startDate": "2024-11-26",
                "endDate": "2024-12-26",
                "term": 30,
                "relationId": "5ad297d731f74225a660f01ddb83c0e9",
                "isOverdue": "1",
                "queryReason": "1",
                "useCache": null,
                "useCacheDays": null,
                "ruleResult": "1",
                "ruleDesc": null,
                "submitUser": "000180",
                "submitDeptid": "运营科技部",
                "submitTime": "2025-02-24 20:29:36",
                "remark1": "",
                "remark2": "20250108;",
                "remark3": "",
                "submitUserName": "孙志阳",
                "frontImageUrl": "192.168.51.19:8083/2,5543391502bc",
                "backImageUrl": "192.168.51.19:8083/5,55e0450d8ee8",
                "frontOcrId": null,
                "backOcrId": null,
                "frontImageStatus": "1",
                "backImageStatus": "1",
                "noBussDesc": null,
                "sponsorId": null,
                "sponsorDeptid": null,
                "certBegin": "2012-10-01",
                "certEnd": "2032-10-01",
                "certIsLong": "N",
                "homeAddress": null,
                "homeAddressCode": null,
                "homeAddressValue": null,
                "nation": "汉",
                "signOrg": null,
                "currentPage": null,
                "numPerPage": null,
                "flowId": "79259578c5a145118d56fea20ef98014",
                "flowStatus": "1",
                "flowSignTime": "",
                "imageStatus": null,
                "ruleRemark": null,
                "edealStartTime": null,
                "edealEndTime": null,
                "submitStartTime": null,
                "submitEndTime": null,
                "departs": null,
                "sponsorName": null,
                "sponsorDeptName": null,
                "queryType": null,
                "dealerIds": null,
                "dealerUsers": null
            },
            {
                "id": "8d24a87d49e147239edb9c3c4478a143",
                "version": 0,
                "status": "1",
                "creator": "000181",
                "createTime": "2024-09-25 15:07:43",
                "editor": "000181",
                "editTime": "2025-01-09 08:32:22",
                "remark": "",
                "bussNo": "NJZL-ZX-202409-0004",
                "name": "时成志",
                "certType": "ID_CARD",
                "certNo": "231085198808111031",
                "roleType": "1",
                "mobile": "13796055032",
                "startDate": "2024-09-25",
                "endDate": "2034-09-25",
                "term": null,
                "relationId": "f93a506eeb624622844b3dce28959a62",
                "isOverdue": "0",
                "queryReason": "1",
                "useCache": null,
                "useCacheDays": null,
                "ruleResult": "4",
                "ruleDesc": null,
                "submitUser": "000181",
                "submitDeptid": "运营科技部",
                "submitTime": "2024-09-25 15:09:21",
                "remark1": "",
                "remark2": "20250108;",
                "remark3": "",
                "submitUserName": "时成志",
                "frontImageUrl": "192.168.51.19:8081/3,4fad080b4ca2",
                "backImageUrl": "192.168.51.19:8083/4,4faeffbd0b1e",
                "frontOcrId": null,
                "backOcrId": null,
                "frontImageStatus": "0",
                "backImageStatus": "0",
                "noBussDesc": null,
                "sponsorId": null,
                "sponsorDeptid": null,
                "certBegin": null,
                "certEnd": null,
                "certIsLong": "N",
                "homeAddress": null,
                "homeAddressCode": null,
                "homeAddressValue": null,
                "nation": null,
                "signOrg": null,
                "currentPage": null,
                "numPerPage": null,
                "flowId": "6cf5c4f74953423e9b455d346fe65077",
                "flowStatus": "2",
                "flowSignTime": "",
                "imageStatus": null,
                "ruleRemark": null,
                "edealStartTime": null,
                "edealEndTime": null,
                "submitStartTime": null,
                "submitEndTime": null,
                "departs": null,
                "sponsorName": null,
                "sponsorDeptName": null,
                "queryType": null,
                "dealerIds": null,
                "dealerUsers": null
            },
            {
                "id": "a566724c72a648848f981f8bc3c2411a",
                "version": 0,
                "status": "1",
                "creator": "000122",
                "createTime": "2024-09-10 16:02:51",
                "editor": "000122",
                "editTime": "2024-11-19 15:49:37",
                "remark": "",
                "bussNo": "NJZL-ZX-202409-0001",
                "name": "刁维立",
                "certType": "ID_CARD",
                "certNo": "230227198605170812",
                "roleType": "1",
                "mobile": "18145100270",
                "startDate": "2024-09-10",
                "endDate": "2024-10-10",
                "term": 1,
                "relationId": "5ad297d731f74225a660f01ddb83c0e9",
                "isOverdue": "0",
                "queryReason": "1",
                "useCache": null,
                "useCacheDays": null,
                "ruleResult": "1",
                "ruleDesc": null,
                "submitUser": "000122",
                "submitDeptid": "现代农业业务部三部",
                "submitTime": "2024-09-10 16:03:11",
                "remark1": "",
                "remark2": "",
                "remark3": "",
                "submitUserName": "于靖麒",
                "frontImageUrl": "192.168.51.19:8083/1,4e135151bc23",
                "backImageUrl": "192.168.51.19:8083/2,4e14f04fbdee",
                "frontOcrId": null,
                "backOcrId": null,
                "frontImageStatus": "1",
                "backImageStatus": "1",
                "noBussDesc": null,
                "sponsorId": null,
                "sponsorDeptid": null,
                "certBegin": "2010-12-18",
                "certEnd": "2020-12-18",
                "certIsLong": "N",
                "homeAddress": null,
                "homeAddressCode": null,
                "homeAddressValue": null,
                "nation": "维吾尔",
                "signOrg": null,
                "currentPage": null,
                "numPerPage": null,
                "flowId": "8d0defe0a5d447398dc60ab7b4111c1d",
                "flowStatus": "2",
                "flowSignTime": "2024-09-10 16:06:11",
                "imageStatus": null,
                "ruleRemark": null,
                "edealStartTime": null,
                "edealEndTime": null,
                "submitStartTime": null,
                "submitEndTime": null,
                "departs": null,
                "sponsorName": null,
                "sponsorDeptName": null,
                "queryType": null,
                "dealerIds": null,
                "dealerUsers": null
            },
            {
                "id": "21259994c1684041aef2077cd4a19a40",
                "version": 0,
                "status": "1",
                "creator": "000171",
                "createTime": "2024-08-06 16:08:09",
                "editor": "000171",
                "editTime": "2025-01-09 08:32:22",
                "remark": "",
                "bussNo": "NJZL-ZX-202408-0001",
                "name": "李林锋",
                "certType": "ID_CARD",
                "certNo": "410481198106013030",
                "roleType": "1",
                "mobile": "15244618278",
                "startDate": null,
                "endDate": null,
                "term": null,
                "relationId": "33f2e3275a72439d843fc84f09d4076a",
                "isOverdue": "0",
                "queryReason": "1",
                "useCache": null,
                "useCacheDays": null,
                "ruleResult": "1",
                "ruleDesc": null,
                "submitUser": "000171",
                "submitDeptid": "运营科技部",
                "submitTime": "2024-08-06 16:08:16",
                "remark1": "",
                "remark2": "20250108;",
                "remark3": "",
                "submitUserName": "魏国鹏",
                "frontImageUrl": "192.168.51.19:8083/5,4d351d214f86",
                "backImageUrl": "192.168.51.19:8083/4,4d36f48e98a3",
                "frontOcrId": null,
                "backOcrId": null,
                "frontImageStatus": "1",
                "backImageStatus": "1",
                "noBussDesc": null,
                "sponsorId": null,
                "sponsorDeptid": null,
                "certBegin": "2023-06-26",
                "certEnd": "2043-06-26",
                "certIsLong": "N",
                "homeAddress": null,
                "homeAddressCode": null,
                "homeAddressValue": null,
                "nation": "汉",
                "signOrg": null,
                "currentPage": null,
                "numPerPage": null,
                "flowId": "cbd564bb2de5444886d53032185d8170",
                "flowStatus": "1",
                "flowSignTime": "",
                "imageStatus": null,
                "ruleRemark": null,
                "edealStartTime": null,
                "edealEndTime": null,
                "submitStartTime": null,
                "submitEndTime": null,
                "departs": null,
                "sponsorName": null,
                "sponsorDeptName": null,
                "queryType": null,
                "dealerIds": null,
                "dealerUsers": null
            },
            {
                "id": "9cf34085b7bf410295e090c6bdd725a6",
                "version": 0,
                "status": "1",
                "creator": "000143",
                "createTime": "2024-07-10 14:11:43",
                "editor": "000143",
                "editTime": "2024-07-10 14:11:43",
                "remark": "备注常涛1111",
                "bussNo": "NJZL-ZX-202407-0018",
                "name": "常涛11222",
                "certType": "ID_CARD",
                "certNo": "350802198808285516",
                "roleType": "1",
                "mobile": "18145100270",
                "startDate": null,
                "endDate": null,
                "term": null,
                "relationId": "06688d8720564002866162a4b473b521",
                "isOverdue": "0",
                "queryReason": "1",
                "useCache": null,
                "useCacheDays": null,
                "ruleResult": "1",
                "ruleDesc": null,
                "submitUser": "000180",
                "submitDeptid": "运营科技部",
                "submitTime": "2025-02-24 20:29:51",
                "remark1": "",
                "remark2": "",
                "remark3": "",
                "submitUserName": "孙志阳",
                "frontImageUrl": "192.168.51.19:8081/7,4bae2a7ee385",
                "backImageUrl": "192.168.51.19:8083/1,4bf33cf91fb6",
                "frontOcrId": null,
                "backOcrId": null,
                "frontImageStatus": "1",
                "backImageStatus": "1",
                "noBussDesc": null,
                "sponsorId": null,
                "sponsorDeptid": null,
                "certBegin": "2010-12-18",
                "certEnd": "2020-12-18",
                "certIsLong": "N",
                "homeAddress": null,
                "homeAddressCode": null,
                "homeAddressValue": null,
                "nation": "汉",
                "signOrg": null,
                "currentPage": null,
                "numPerPage": null,
                "flowId": "81f21ae2203e499180cff764dea448b3",
                "flowStatus": "1",
                "flowSignTime": "",
                "imageStatus": null,
                "ruleRemark": null,
                "edealStartTime": null,
                "edealEndTime": null,
                "submitStartTime": null,
                "submitEndTime": null,
                "departs": null,
                "sponsorName": null,
                "sponsorDeptName": null,
                "queryType": null,
                "dealerIds": null,
                "dealerUsers": null
            }]);
  const columns = ref([
    {
      title: '申请号',
      key: 'bussNo',
      dataIndex: 'bussNo',
      width: 160,
      fixed: 'left',
    },
    {
      title: '授权人姓名',
      key: 'name',
      dataIndex: 'name',
      width: 80,
      fixed: 'left',
    },
    {
      title: '证件类型',
      key: 'certType',
      dataIndex: 'certType',
      width: 80,
      slots: { customRender: 'certType' },
    },
    {
      title: '身份证号',
      key: 'certNo',
      dataIndex: 'certNo',
      width: 160,
    },

    {
      title: '手机号',
      key: 'mobile',
      dataIndex: 'mobile',
      width: 100,
    },
    {
      title: '授权角色',
      key: 'roleType',
      dataIndex: 'roleType',
      slots: { customRender: 'roleType' },
      width: 140,
    },
    {
      title: '查询原因',
      key: 'queryReason',
      dataIndex: 'queryReason',
      slots: { customRender: 'queryReason' },
      width: 100,
    },
    {
      title: '签约状态',
      key: 'flowStatus',
      dataIndex: 'flowStatus',
      slots: { customRender: 'flowStatus' },
      width: 100,
    },

    {
      title: '签约完成时间',
      key: 'flowSignTime',
      dataIndex: 'flowSignTime',
      width: 140,
    },
    {
      title: '审核结果',
      key: 'ruleResult',
      slots: { customRender: 'ruleResult' },
      dataIndex: 'ruleResult',
      width: 100,
    },

    {
      title: '有效期',
      key: 'startDate',
      dataIndex: 'startDate',
      slots: { customRender: 'startDate' },
      width: 190,
    },
    {
      title: '身份证识别状态',
      key: 'backImageStatus',
      slots: { customRender: 'backImageStatus' },
      dataIndex: 'backImageStatus',
      width: 100,
    },
    {
      title: '识别民族',
      key: 'nation',
      dataIndex: 'nation',
      width: 100,
    },
    {
      title: '识别证件有效期',
      key: 'certBegin',
      dataIndex: 'certBegin',
      slots: { customRender: 'certBegin' },
      width: 190,
    },
    {
      title: '提交人账号',
      key: 'creator',
      dataIndex: 'creator',
      width: 100,
    },
    {
      title: '提交人名称',
      key: 'name',
      dataIndex: 'name',
      width: 100,
    },
    {
      title: '提交签约时间',
      key: 'submitTime',
      dataIndex: 'submitTime',
      width: 140,
    },
    {
      title: '提交部门',
      key: 'submitDeptid',
      dataIndex: 'submitDeptid',
      width: 150,
    },
    {
      title: '创建时间',
      key: 'createTime',
      dataIndex: 'createTime',
      width: 140,
    },
    {
      title: '操作',
      key: 'operate',
      width: 300,
      dataIndex: 'operate',
      fixed: 'right',
      slots: { customRender: 'operate' },
    },
  ]);
  const pageNo = ref(1);
  const limit = ref(10);
  const roleType = ref([
    {
      optionCode: '1',
      display_default: '1',
      parent_code: '',
      optionName: '承租人',
      status: '1',
    },
    {
      optionCode: '2',
      display_default: '1',
      parent_code: '',
      optionName: '承租人或保证人的配偶',
      status: '1',
    },
    {
      optionCode: '3',
      display_default: '1',
      parent_code: '',
      optionName: '保证人(自然人)',
      status: '1',
    },
    {
      optionCode: '4',
      display_default: '1',
      parent_code: '',
      optionName: '法定代表人、实际控制人、股东等高管',
      status: '1',
    },
  ]);
  const flowStatus = ref([
    {
      optionCode: '0',
      display_default: '1',
      parent_code: '',
      optionName: '待签约',
      status: '1',
    },
    {
      optionCode: '1',
      display_default: '1',
      parent_code: '',
      optionName: '签约中',
      status: '1',
    },
    {
      optionCode: '2',
      display_default: '1',
      parent_code: '',
      optionName: '已签约',
      status: '1',
    },
    {
      optionCode: '3',
      display_default: '1',
      parent_code: '',
      optionName: '已撤销',
      status: '1',
    },
    {
      optionCode: '4',
      display_default: '1',
      parent_code: '',
      optionName: '已终止',
      status: '1',
    },
    {
      optionCode: '5',
      display_default: '1',
      parent_code: '',
      optionName: '已过期',
      status: '1',
    },
    {
      optionCode: '7',
      display_default: '1',
      parent_code: '',
      optionName: '已拒签',
      status: '1',
    },
  ]);
  const certType = ref([
    {
      optionCode: 'PASSPORT',
      display_default: '1',
      parent_code: '',
      optionName: '护照',
      status: '1',
    },
    {
      optionCode: 'MILITARY_ID',
      display_default: '1',
      parent_code: '',
      optionName: '军官证',
      status: '1',
    },
    {
      optionCode: 'ID_CARD',
      display_default: '1',
      parent_code: '',
      optionName: '身份证',
      status: '1',
    },
  ]);
  const queryReason = ref([
    {
      optionCode: '1',
      display_default: '1',
      parent_code: '',
      optionName: '融资审批',
      status: '1',
    },
    {
      optionCode: '2',
      display_default: '1',
      parent_code: '',
      optionName: '资信审查',
      status: '1',
    },
    {
      optionCode: '3',
      display_default: '1',
      parent_code: '',
      optionName: '担保资格审查',
      status: '1',
    },
    {
      optionCode: '4',
      display_default: '1',
      parent_code: '',
      optionName: '法人代表、负责人、高管等资信审查',
      status: '1',
    },
  ]);
  const ruleResult = ref([
    {
      optionCode: '1',
      display_default: '1',
      parent_code: '',
      optionName: '待处理',
      status: '1',
    },
    {
      optionCode: '2',
      display_default: '1',
      parent_code: '',
      optionName: '处理中',
      status: '1',
    },
    {
      optionCode: '3',
      display_default: '1',
      parent_code: '',
      optionName: '拒绝',
      status: '1',
    },
    {
      optionCode: '4',
      display_default: '1',
      parent_code: '',
      optionName: '已通过',
      status: '1',
    },
    {
      optionCode: '41',
      display_default: '1',
      parent_code: '',
      optionName: '已通过(白户)',
      status: '1',
    },
    {
      optionCode: '42',
      display_default: '1',
      parent_code: '',
      optionName: '无征信（姓名不一致）',
      status: '1',
    },
    {
      optionCode: '5',
      display_default: '1',
      parent_code: '',
      optionName: '触发限制条款',
      status: '1',
    },
    {
      optionCode: '6',
      display_default: '1',
      parent_code: '',
      optionName: '异常',
      status: '1',
    },
  ]);
  function onAdd() {
    createRef.value.open();
  }
  function getCertType(code) {
    return code && certType.value.find((item) => item.optionCode == code).optionName;
  }
  function getRoleType(code) {
    return code && roleType.value.find((item) => item.optionCode == code).optionName;
  }
  function getFlowStatus(code) {
    return code && flowStatus.value.find((item) => item.optionCode == code).optionName;
  }
  function getRuleResult(code) {
    return code && ruleResult.value.find((item) => item.optionCode == code).optionName;
  }
  function getQueryReason(code) {
    return code && queryReason.value.find((item) => item.optionCode == code).optionName;
  }
  async function getData() {
    spinning.value = true;
    // 获取下拉
    const res = await zxJobApi.getConstantConfig({ dictionaryCode: ['roleType', 'flowStatus', 'certType', 'queryReason', 'ruleResult'] });
    if (res.code == 0) {
      roleType.value = res.data.roleType;
      flowStatus.value = res.data.flowStatus;
      certType.value = res.data.certType;
      queryReason.value = res.data.queryReason;
      ruleResult.value = res.data.ruleResult;
    }
    spinning.value = false;
  }
  async function onSignQry(id) {
    spinning.value = true;
    const res = await zxJobApi.signQry({ id });
    if (res.code == 0) {
      this.getData();
    } else {
      spinning.value = false;
    }
  }
  async function onSignRush(id) {
    spinning.value = true;
    const res = await zxJobApi.signQry({ id });
    if (res.code == 0) {
      this.getData();
    } else {
      spinning.value = false;
    }
  }
  async function onSignQryUrl(id) {
    spinning.value = true;
    const res = await zxJobApi.signQryUrl({ id });
    if (res.code == 0) {
      handleCopy(res.data.shortUrl);
      this.getData();
    } else {
      spinning.value = false;
    }
  }
  async function onSignRevoke(id) {
    spinning.value = true;
    const res = await zxJobApi.signRevoke({ id });
    if (res.code == 0) {
      this.getData();
    } else {
      spinning.value = false;
    }
  }
  async function onPreviewDownAuth(vdType, contractType, record) {
    spinning.value = true;
    const res = await zxJobApi.previewDownAuth({ id: record.id, vdType, contractType });
    if (res.code == 0) {
      this.getData();
    } else {
      spinning.value = false;
    }
  }
  async function onSignStart(id) {
    spinning.value = true;
    const res = await zxJobApi.signStart({ id });
    if (res.code == 0) {
      message.success('提交成功!');
      this.getData();
    } else {
      message.error('提交失败!');
      spinning.value = false;
    }
  }
  async function onPreviewAuthReport(bussNO) {
    spinning.value = true;
    const res = await zxJobApi.previewAuthReport({ bussNO });
    if (res.code == 0) {
      console.log(res);
      const newW = window.open();
      newW.write(`'res'`);
      newW.close();
    } else {
      message.error('报告文件不存在!');
    }
  }
  async function onDel(id) {
    Modal.confirm({
      title: '系统提示',
      icon: createVNode(ExclamationCircleOutlined),
      content: '删除征信授权数据后不可恢复,确定删除？',
      onOk: async () => {
        spinning.value = true;
        const res = await zxJobApi.del({ id: item.id });
        if (res.code == 0) {
          message.success('删除成功!');
          this.getData();
        } else {
          message.error('提交失败!');
          spinning.value = true;
        }
      },
      onCancel() {
        console.log('Cancel');
      },
    });

    spinning.value = true;
    const res = await zxJobApi.signStart({ id });
    if (res.code == 0) {
      message.success('提交成功!');
      this.getData();
    } else {
      message.error('提交失败!');
      spinning.value = false;
    }
  }
  async function handleCopy(txt) {
    try {
      await toClipboard(txt);
      message.success('复制成功');
    } catch (e) {
      message.warning('复制失败');
    }
  }

  function openHtmlInNewWindow(htmlContent) {
    // const blob = new Blob([htmlContent], { type: 'text/html' });
    // const url = URL.createObjectURL(blob);
    // window.open(url, '_blank');
    const newWindow = window.open('', '_blank'); // 打开一个新窗口
    newWindow.document.open(); // 打开文档流以写入内容
    newWindow.document.write(htmlContent); // 写入HTML内容
    newWindow.document.close(); // 关闭文档流
  }
  function onSubmit() {
    const htmlContent = `
<html>
<head><title>新页面</title></head>
<body>
<h1>这是标题</h1>
<p>这是段落。</p>
</body>
</html>
`;

    openHtmlInNewWindow(htmlContent);
  }
</script>
<style scoped lang="less">
  @import url(../rzApply/index.less);
  .app-page {
    width: 100%;
    box-sizing: border-box;
    padding: 16rem 24rem;
    .query-top {
      display: flex;
      align-items: flex-start;
      margin-bottom: 13rem;

      .ant-form-item {
        margin-bottom: 16rem;
        margin-right: 24rem;
      }
      .ant-btn {
        width: 120rem;
        height: 40rem !important;
      }
      .add {
        width: 240rem !important;
        height: 60rem !important;
      }
    }
  }
</style>
